package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.OrdersPageQueryDTO;
import com.github.pagehelper.Page;
import com.sky.dto.OrdersConfirmDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.entity.OrderDetail;
import com.sky.entity.Orders;
import com.sky.vo.OrderCountVo;
import com.sky.vo.OrderVO;
import com.sky.vo.OrderVO;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OrdersMapper {
    // 新增订单
    void insert(Orders orders);

    /**
     * 根据订单号和用户id查询订单
     * @param orderNumber
     * @param userId
     */
    @Select("select * from orders where number = #{orderNumber} and user_id= #{userId}")
    Orders getByNumberAndUserId(String orderNumber, Long userId);

    /**
     * 修改订单信息
     * @param orders
     */
    void update(Orders orders);

    /**
     * 根据订单id获取订餐细节
     * @param id
     * @return
     */
    List<OrderDetail> getByOrderId(Long id);


    List<Orders> getByUserId(Long userId);
    @Select("select * from orders where id=#{id}")
    Orders getById(Long id);

    Page<OrderVO> page(OrdersPageQueryDTO dto);

    /**
     * 订单搜索
     * @param dto
     * @return
     */
    Page<OrderVO> getByPage(OrdersPageQueryDTO dto);

    List<OrderCountVo> countStatus();

    /**
     * 各个状态的订单数量统计
     * @return
     */



}
